<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use DateTimeInterface;

class BannerModel extends Model
{
    const TYPE = ['仅展示','内部跳转','外部跳转'];
    const STATUS = ['禁用','显示'];

    const STATUS_VAL = [
        'on'  => ['value' => 1, 'text' => '显示', 'color' => 'success'],
        'off' => ['value' => 0, 'text' => '禁用', 'color' => 'danger'],
    ];

    use HasFactory;
    protected $table = 'banner';

    /**
     * 为数组 / JSON序列化准备一个日期
     * @param  \DateTimeInterface  $date
     * @return string
     */
    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format('Y-m-d H:i:s');
    }
}
